:root {
    --primary-color: linear-gradient(to right, #00c6ff, #0072ff, #00c6ff); /* 科技感蓝色 */
    --bg-color: #f4f7fc; /* 明亮干净的背景色 */
    --text-color: #2b2d42; /* 深灰色，易于阅读 */
    --message-bg: #ffffff;
    --bot-message-bg:  #E8F0FF; /* 淡蓝背景，优雅且现代 */
    --user-message-bg: #D7E5F5;
    --user-message-color: #111111;
    --sidebar-width: 300px;
    --sidebar-collapsed-width: 0px;
    --header-height: 60px;
    --message-radius: 1.2rem; /* 更圆润的圆角 */
    --message-shadow: 0 4px 24px rgba(0, 0, 0, 0.08); /* 更柔和的阴影效果 */
    --hover-transform: translateY(-5px); /* 更有动感的hover效果 */
    --hover-shadow: 0 12px 32px rgba(0, 0, 0, 0.12); /* 更大的hover阴影 */
    --animation-duration: 0.3s;
    --avatar-size: 60px; /* 稍大的头像 */
    --avatar-margin: 10px; /* 更宽松的头像边距 */
    --settings-width: 500px; /* 稍微窄一点的设置宽度 */
    --theme-color-default: #111111; /* 科技蓝到紫 */
    --theme-color-blue: linear-gradient(to right, #0072ff, #1e3c72, #6a5acd); /* 深蓝到紫色 */
    --theme-color-purple: linear-gradient(to right, #6a5acd, #9b4dca, #f05485); /* 紫色到粉红渐变 */
    --theme-color-red: linear-gradient(to right, #f05485, #ff5e57, #f7a072); /* 温暖的红色渐变 */
    --theme-color-orange: linear-gradient(to right, #ff5e57, #ff8e53, #ffbf00); /* 明亮的橙色渐变 */
    --theme-color-green: linear-gradient(to right, #00c6ff, #32e0c2, #28a745); /* 清新的绿色 */
    --theme-color-pink: linear-gradient(to right, #f7a072, #ff7eb9, #d946ef); /* 现代的粉色渐变 */
    --theme-color-yellow: linear-gradient(to right, #ffbf00, #ffcc00, #f4d03f); /* 温暖的黄色 */
    --theme-color-indigo: linear-gradient(to right, #6a5acd, #9b4dca, #4c3b5c); /* 紫色到深红的渐变 */
    --theme-color-cyan: linear-gradient(to right, #32e0c2, #00b4d8, #4f96b5); /* 现代的青色渐变 */
    --theme-color-sky: linear-gradient(to right, #00c6ff, #4c6ef5, #00d2b1); /* 天空蓝到青绿色 */
    --theme-color-lime: linear-gradient(to right, #84cc16, #28a745, #00ff9d); /* 亮眼的绿色到青色 */
    --theme-color-amber: linear-gradient(to right, #ffbf00, #ff8e53, #f59e0b); /* 现代的琥珀色 */
    --theme-color-emerald: linear-gradient(to right, #10b981, #2d9a6b, #2db39e); /* 珊瑚绿到青绿色 */
    --theme-color-rose: linear-gradient(to right, #f43f5e, #ff6b81, #ee5e6c); /* 玫瑰色的柔和渐变 */
    --theme-color-fuchsia: linear-gradient(to right, #d946ef, #b56ef2, #9c50b3); /* 哑光紫粉渐变 */
    --current-theme: var(--theme-color-default);
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

.app-container {
    display: flex;
    height: 95vh;
    width: 100%;
}

.conversation-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversation-header {
    padding: 0.75rem 1rem;
    /* 调整内边距 */
    font-weight: bold;
    border-bottom: 1px solid #e5e5e5;
    font-size: 0.95rem;
}

.conversation-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.conversation-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    /* 减小字体大小 */
    line-height: 1.4;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    gap: 8px;
    /* 添加间距 */
}

.conversation-content {
    flex: 1;
    min-width: 0;
    /* 允许flex项目收缩到比内容更小 */
    cursor: pointer;
}

.conversation-content>div:first-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.delete-btn {
    padding: 5px;
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    flex-shrink: 0;
    /* 防止按钮被压缩 */
}

.delete-btn:hover {
    opacity: 1;
}

.conversation-item:hover {
    background-color: var(--message-bg);
}

.conversation-item.active {
    background-color: #000000;
    color: white;
}

.conversation-item.active .time {
    color: rgba(255, 255, 255, 0.8);
}

.conversation-item .time {
    font-size: 0.75rem;
    /* 减小时间字体大小 */
    color: #666;
    margin-top: 0.25rem;
}

.chat-container {
    flex: 1;
    max-width: none;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-color);
    margin-bottom: 5rem;
}

.message {
    /* 使用 flex 布局，设置为行排列 */
    display: flex;
    flex-direction: row;
    /* 子元素在交叉轴上对齐方式设为顶部对齐 */
    align-items: flex-start;
    /* 左右内边距 1rem，使内容不贴边 */
    padding: 0 2rem;
    /* 消息间的下边距 1rem */
    margin-bottom: 1rem;
    /* 最大宽度限制为容器的 85% */
    max-width: 85%;
    /* 宽度由内容决定 */
    width: fit-content;
    /* 用于定位时间戳等绝对定位元素 */
    position: relative;
    /* 删除初始透明度和过渡效果 */
    /* opacity: 0; */
    /* transition: opacity 0.3s ease; */
    min-height: 60px;
    /* 添加最小高度防止抖动 */
}

/* 显示消息时的样式 */
.message.show {
    /* 设置消息的透明度为完全不透明 */
    opacity: 1;
    /* 将消息的垂直位置设置为初始位置 */
    transform: translateY(0);
}

/* 机器人消息的样式 */
.message.bot {
    /* 将消息对齐到容器的起始位置 */
    align-self: flex-start;
    /* 自动设置右边距以确保消息靠左对齐 */
    margin-right: auto;
}

/* 用户消息的样式 */
.message.user {
    /* 将消息对齐到容器的结束位置 */
    align-self: flex-end;
    /* 自动设置左边距以确保消息靠右对齐 */
    margin-left: auto;
    /* 将消息内容的排列方向设置为从右到左 */
    flex-direction: row-reverse;
}

/* 新增：头像样式 */
.avatar {
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    margin: 0 var(--avatar-margin);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: transform 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
}

.message-content-wrapper {
    flex: 0 1 auto;
    min-width: 200px;
    max-width: calc(100% - var(--avatar-size) - (var(--avatar-margin) * 2));
}

.message-content {
    max-width: 100%;
    overflow-wrap: break-word;
    line-height: 1.6;
    width: auto;
    min-width: 100%;
    padding: 1rem;
    border-radius: var(--message-radius);
    box-shadow: var(--message-shadow);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease, opacity 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.04);
    backdrop-filter: blur(8px);
}

/* 显示消息内容时的样式 */
.message-content.show-content {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
    /* 添加过渡效果 */
}

/* 消息内容段落的样式 */
.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow: hidden;
    width: 100%;
    display: block;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* 显示消息内容段落时的样式 */
.message-content.show-content p {
    opacity: 1;
    transform: translateY(0);
}

/* 消息内容段落中span元素的样式 */
.message-content p span {
    display: inline;
    opacity: 1;
    /* 直接显示 */
    transform: translateY(0);
    /* 取消动画 */
}

/* 定义fadeInDown动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    margin: 1rem 0 0.5rem;
    line-height: 1.4;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.25rem 0;
}

.message-content code {
    font-family: 'Fira Code', 'Cascadia Code', 'Source Code Pro', Consolas, Monaco, 'Courier New', monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    white-space: pre-wrap;
    /* 允许代码换行 */
    word-break: break-all;
    /* 确保长字符串会换行 */
}

.message-content pre {
    position: relative;
    background: #1e1e1e;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
}

.message-content pre code {
    padding: 0;
    background: none;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre;
    display: block;
    overflow-x: auto;
    tab-size: 4;
}

.code-toolbar {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-content pre:hover .code-toolbar {
    opacity: 1;
}

.copy-button {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    color: #666;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: #f0f0f0;
    border-color: #ccc;
    transform: scale(1.05);
}

.copy-button.copied {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    animation: copiedPulse 0.3s ease;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}

.message-content th,
.message-content td {
    padding: 0.5rem;
    border: 1px solid #ddd;
    text-align: left;
}

.message-content th {
    background: #f6f8fa;
}

.message-content blockquote {
    margin: 1rem 0;
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--primary-color);
    background: #f6f8fa;
    color: #666;
}

.input-container {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    width: auto;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem 0.75rem 0 0;
    background: var(--bg-color);
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
    padding: 1rem;
    z-index: 100;
}

textarea {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    resize: none;
    /* 禁止用户手动调整 */
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    min-height: 20px;
    max-height: 200px;
    /* 最大高度 */
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
}

textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.15);
}

textarea::-webkit-scrollbar {
    width: 6px;
}

textarea::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s var(--animation-timing);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.typing-indicator {
    display: inline-block;
    margin-left: 4px;
}

.typing-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    margin: 0 2px;
    background-color: var(--text-color);
    border-radius: 50%;
    animation: typing-dot 1.4s infinite;
}

@keyframes typing-dot {

    0%,
    20% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }

    80%,
    100% {
        transform: translateY(0);
    }
}

.input-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.upload-button {
    background: transparent;
    color: var(--text-color);
    padding: 0.5rem;
    opacity: 0.7;
}

.upload-button:hover {
    background: var(--message-bg);
    opacity: 1;
}

.attachment-preview {
    position: absolute;
    bottom: 100%;
    /* 使其漂浮在输入框上方 */
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
    /* 默认隐藏 */
}

.preview-image {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-image .remove-button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

.preview-image:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.suggestions-container {
    width: 100%;
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.suggestion-item {
    background: var(--bg-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: left;
    transform-origin: left center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-item:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.02) translateX(4px);
    box-shadow: var(--message-shadow);
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-color);
    border-right: 1px solid #e5e5e5;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-header {
    padding: 0.75rem;
    /* 调整内边距 */
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
}

.new-chat-button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.new-chat-button:hover {
    background-color: var(--primary-color);
}

.toggle-sidebar-button {
    background: transparent;
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-sidebar-button:hover {
    background: var(--message-bg);
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.toggle-sidebar-button:active {
    transform: translateY(0);
    box-shadow: none;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    transition: margin-left 0.3s ease;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-content.sidebar-collapsed {
    margin-left: 0;
}

.welcome-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.welcome-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.welcome-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.welcome-suggestions {
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.suggestions-group {
    flex: 1;
    min-width: 300px;
}

.suggestions-group h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    opacity: 0.8;
}

.welcome-suggestion-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.welcome-suggestion-items button {
    background: var(--bg-color);
    border: 1px solid #e5e5e5;
    color: var(--text-color);
    padding: 1rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.95rem;
}

.welcome-suggestion-items button:hover {
    background: var(--message-bg);
    border-color: var(--primary-color);
}

.menu-button {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.show-sidebar-button {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--primary-color);
    border-radius: 50%;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.show-sidebar-button.visible {
    display: flex;
}

.welcome-input-container {
    width: 100%;
    max-width: 800px;
    margin-top: 2rem;
}

.welcome-page .input-container {
    position: fixed;
    /* Fixed position to stick to bottom */
    bottom: 0;
    /* Align to bottom */
    left: var(--sidebar-width);
    /* Account for sidebar */
    right: 0;
    /* Stretch to right edge */
    width: auto;
    /* Width controlled by left/right */
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem 0.75rem 0 0;
    /* Rounded top corners only */
    background: var(--bg-color);
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
    padding: 1rem;
    z-index: 100;
}

/* When sidebar is collapsed */
.sidebar-collapsed .welcome-page .input-container {
    left: 0;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }

    .sidebar.mobile-visible {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .menu-button {
        display: flex;
    }

    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .overlay.visible {
        display: block;
    }

    .welcome-suggestions {
        flex-direction: column;
        padding: 0 1rem;
    }

    .suggestions-group {
        min-width: 100%;
    }

    .show-sidebar-button.visible {
        display: flex;
    }

    .welcome-input-container {
        padding: 0 1rem;
    }
}

.conversation-items::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.conversation-items::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.conversation-items::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.loading,
.error,
.no-conversations {
    padding: 1rem;
    color: #666;
    font-size: 0.9rem;
}

.error {
    color: #ff4d4f;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.loading:after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #999;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.message-content a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    font-weight: 500;
}

.message-content a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.message-content a:hover::after {
    transform: scaleX(1);
}

.message.user .message-content a {
    color: var(--user-message-color);
    text-decoration: underline;
    opacity: 0.9;
}

.message.bot .message-content pre {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.user .message-content pre {
    background: rgba(0, 0, 0, 0.1);
    border: none;
}

.message::after {
    content: attr(data-time);
    position: absolute;
    bottom: -1.2rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.7;
    align-self: flex-end;
}

.message.bot::after {
    color: #666;
    left: calc(var(--avatar-size) + var(--avatar-margin) * 2);
}

.message.user::after {
    color: var(--user-message-color);
    right: calc(var(--avatar-size) + var(--avatar-margin) * 2);
}

.message-content pre {
    margin: 0.5rem -1rem;
    padding: 1rem;
    background: #282c34;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.message-content pre:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message.user .message-content pre code {
    color: #abb2bf;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.message.user .message-content {
    border-radius: var(--message-radius) var(--message-radius) 0 var(--message-radius);
    background: linear-gradient(135deg, var(--user-message-bg), #ffffff);
    color: rgba(0, 0, 0, 0.85); /* 提高对比度，增强可读性 */
    font-family: "Inter", "Segoe UI", sans-serif; /* 现代、清晰的字体 */
    font-size: 16px; /* 适中字体，提升可读性 */
    font-weight: 500; /* 略微加粗，使文字更清晰 */
    line-height: 1.6; /* 增加行高，提高阅读体验 */
    padding: 12px 16px; /* 适中内边距，保持舒适布局 */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); /* 轻微阴影，增加立体感 */
}


.message.bot .message-content {
    border-radius: var(--message-radius) var(--message-radius) var(--message-radius) 0;
    background: linear-gradient(135deg, #ffffff, var(--bot-message-bg));
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.message:hover .message-content {
    transform: var(--hover-transform);
    box-shadow: var(--hover-shadow);
    transform: translateY(-2px);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.message.bot .message-content:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.message.user .message-content:hover {
    box-shadow: 0 4px 12px rgba(8, 8, 8, 0.25);
}

.message.bot.typing .message-content {
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes sendPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

#sendButton:active {
    animation: sendPulse 0.3s ease;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.message.bot.loading {
    align-self: flex-start;
}

.message.bot.loading .message-content {
    background: linear-gradient(90deg,
            #f7f7f8 0%,
            #ffffff 50%,
            #f7f7f8 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    position: relative;
    overflow: hidden;
}

.message.bot.loading .message-content::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.6),
            transparent);
    animation: shimmerOverlay 1.5s infinite;
}

@keyframes shimmerOverlay {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

@keyframes typingPulse {
    0% {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }

    50% {
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    }

    100% {
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 1rem;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    border-radius: 50%;
    opacity: 0.6;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-4px);
    }
}

@keyframes copiedPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes newMessage {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.message.new {
    animation: newMessage 0.4s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.new {
    animation: messageSlideIn 0.3s ease-out forwards;
}

/* 添加消息堆叠动画延迟 */
.message:nth-child(n+1) {
    animation-delay: calc(0.1s * var(--message-index, 0));
}

.settings-button {
    background: transparent;
    color: var(--text-color);
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    margin-left: auto;
    /* Add this line to push button to right */
}

.settings-button:hover {
    background: var(--message-bg);
    opacity: 1;
}

.settings-page {
    position: fixed;
    /* 改为fixed定位 */
    top: 0;
    left: var(--sidebar-width);
    /* 添加左侧偏移 */
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background: var(--bg-color);
    z-index: 1000;
    overflow-y: auto;
    /* 添加滚动 */
}

.main-content.sidebar-collapsed .settings-page {
    left: 0;
    /* 当侧边栏收起时调整位置 */
}

.settings-content {
    width: 100%;
    max-width: var(--settings-width);
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 添加主题选择器样式 */
.theme-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1rem 0;
}

.theme-option {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
}

.theme-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.theme-option.active {
    border-color: var(--text-color);
    transform: scale(1.1);
}

.theme-option.active::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.settings-content h2 {
    margin-bottom: 2rem;
    color: var(--text-color);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid #e5e5e5;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.1);
}

.save-button {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.save-button:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
}

/* 修改用户信息显示样式 */
.user-info {
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 0.75rem;
    border-bottom: 1px solid #e5e5e5;
    background: var(--message-bg);
}

.user-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-name {
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.95rem;
}

.button,
.new-chat-button,
.save-button {
    background-color: var(--primary-color);
}

.button:hover,
.new-chat-button:hover,
.save-button:hover {
    background-color: color-mix(in srgb, var(--primary-color) 85%, black);
}

.code-block {
    position: relative;
    margin: 1em 0;
    background: #f5f5f5;
    border-radius: 4px;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5em 1em;
    background: #e0e0e0;
    border-bottom: 1px solid #ddd;
}

.language-badge {
    font-size: 0.8em;
    color: #666;
    text-transform: uppercase;
}

.code-actions {
    display: flex;
    gap: 8px;
}

.code-actions button {
    padding: 4px 8px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.3s;
}

.code-actions button:hover {
    background: color-mix(in srgb, var(--primary-color) 85%, white);
}

.line {
    display: flex;
    padding: 0 0.5em;
}

.line-number {
    color: #999;
    padding-right: 1em;
    user-select: none;
    min-width: 2em;
    text-align: right;
}

.line-content {
    flex: 1;
}

pre {
    margin: 0;
    padding: 1em;
    overflow-x: auto;
}

.voice-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: fit-content;
    height: fit-content;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.85);
    /* 改为半透明背景 */
    backdrop-filter: blur(8px);
    /* 添加毛玻璃效果 */
    border-radius: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    padding: 2rem;
}

.chat-body {
    flex-grow: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    width: fit-content;
    margin: 0;
    background-color: transparent;
    /* 移除背景色 */
}

.mic-button {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(145deg, #11b88e, #0e906f);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 6px 12px rgba(16, 163, 127, 0.3);
}

.mic-button::before,
.mic-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary-color), var(--primary-color));
    opacity: 0;
    animation: pulseDouble 3s infinite;
}

.mic-button::after {
    animation-delay: 1s;
}

.mic-button:hover {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 10px 20px rgba(16, 163, 127, 0.4);
}

.mic-button:active {
    transform: scale(0.95);
}

@keyframes pulseDouble {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        opacity: 0;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.wave-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
    margin-top: 40px;
    gap: 3px;
    perspective: 1000px;
}

.wave {
    width: 4px;
    height: 30px;
    background: linear-gradient(to top, #10a37f, #11b88e);
    border-radius: 4px;
    animation: waveform 1.0s infinite ease-in-out;
    /* 从1.2s改为2s */
    transform-origin: bottom;
    box-shadow: 0 2px 6px rgba(16, 163, 127, 0.2);
}

@keyframes waveform {

    0%,
    100% {
        transform: scaleY(0.2);
        opacity: 0.5;
    }

    50% {
        transform: scaleY(1);
        opacity: 1;
    }
}

.recording .mic-button {
    background: linear-gradient(145deg, #ff5f5f, #ff4a4a);
    box-shadow: 0 6px 12px rgba(255, 74, 74, 0.3);
}

.recording .mic-button::before,
.recording .mic-button::after {
    background: linear-gradient(145deg, #ff5f5f, #ff4a4a);
}

.recording .wave {
    background: linear-gradient(to top, #ff4a4a, #ff5f5f);
    box-shadow: 0 2px 6px rgba(255, 74, 74, 0.2);
}

/* 添加新的动态波浪效果 */
.wave:nth-child(odd) {
    animation-delay: 0.8s;
    /* 从0.4s改为0.8s */
}

.wave:nth-child(even) {
    animation-delay: 1.6s;
    /* 从0.8s改为1.6s */
}

.status-text {
    margin-top: 25px;
    font-size: 1.1em;
    /* 增大字体 */
    color: #000000;
    /* 加深文字颜色 */
    font-weight: 600;
    /* 加粗 */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.02em;
    /* 增加字间距 */
}

.mic-icon {
    width: 36px;
    /* 增大图标 */
    height: 36px;
    fill: #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    /* 添加图标阴影 */
}

/* 添加机器人回复状态样式 */
.bot-replying .wave {
    background: linear-gradient(to top, #7c3aed, #8b5cf6);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.2);
}

.bot-replying .status-text {
    color: #7c3aed;
}

.typing-dots {
    display: none;
}

.bot-replying .typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background-color: #7c3aed;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5);
    }
}

/* 弹窗背景 */
.modal {
    display: none;
    position: fixed;
    z-index: 9999999; /* 使用非常高的 z-index 值 */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* 防止滚动 */
    background-color: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    will-change: opacity;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.modal.show {
    display: block; /* 确保显示 */
    opacity: 1;
}

/* 弹窗内容 */
.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    border-radius: 8px; /* 添加圆角 */
    width: 80%;
    max-width: 400px;
    text-align: center;
    z-index: 10000000; /* 比 modal 更高的 z-index */
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加阴影 */
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    margin: 10px;
    cursor: pointer;
    border: none;
    color: white;
    border-radius: 4px; /* 添加圆角 */
    transition: background-color 0.2s ease; /* 添加过渡效果 */
}

.confirm-btn {
    background-color: var(--primary-color);
}

.confirm-btn:hover {
    background-color: var(--primary-color-dark, #45a049); /* 添加悬停效果 */
}

.cancel-btn {
    background-color: #f44336;
}

.cancel-btn:hover {
    background-color: #d32f2f; /* 添加悬停效果 */
}

/* 防止页面滚动 */
body.modal-open {
    overflow: hidden;
}
.main-content .welcomePage .welcome-content h1{
    font-family: monospace;
    font-size: 20px;
    white-space: pre-wrap;
}